package com.facetime.cloud.server.action;

import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.facetime.cloud.server.bean.CloudServerBean;
import com.facetime.cloud.server.entity.CloudServer;
import com.facetime.core.commons.Action;

@Controller()
@RequestMapping("/cloud/server/")
public class CloudServerAction extends Action {

	@RequestMapping("/list")
	public String list(ModelMap model) {
		List<CloudServer> list = this.defaultLogic.findList(CloudServer.class);
		System.out.println(list);
		model.put("list", list);
		return "test/list";
	}

	@RequestMapping("/add")
	public String add(CloudServerBean bean, ModelMap model) {
		this.getDefaultLogic().save(new CloudServer(bean));
		return "redirect:/cloud/server/list.do";
	}

	@RequestMapping("/addUI")
	public String addUI() {
		return "test/add";
	}
}
